home *** CD-ROM | disk | FTP | other *** search
- -*- Mode: Text; -*-
-
- File README / Copyright (c) 1991 Jonathan Rees / See file COPYING
-
- This is Pseudoscheme, developed by Jonathan Rees at the MIT AI Lab and
- the Cornell Robotics and Vision Laboratory (jar@altdorf.ai.mit.edu,
- jar@cs.cornell.edu).
-
- Send mail to info-clscheme-request@mc.lcs.mit.edu to be put on a
- mailing list for announcements.
-
- See the end of this file for differences between version 2.7 and
- version 2.8.
- ----------
-
- Here is some documentation.
-
-
- INSTALLATION.
-
- This version (version 2.8) of Pseudoscheme was developed using Sun
- (Lucid) Common Lisp. Earlier versions of Pseudoscheme have been
- tested in Symbolics CL, VAX LISP under VMS, Explorer CL, and a few
- other Common Lisps. If you're installing Pseudoscheme in some other
- version of Common Lisp, you may have to customize a few things:
- - edit the definitions of SOURCE-FILE-TYPE and OBJECT-FILE-TYPE
- in "clever.lisp" as appropriate;
- - edit the definition of PREFERRED-CASE in "loadit.lisp" as appropriate
- for your file system;
- - rename file "clever.lisp" if necessary so that your Common Lisp's LOAD
- can find it given just the name "clever".
- Please send your customizations to jar@altdorf.ai.mit.edu so that they
- can be distributed to other users.
-
-
- RUNNING PSEUDOSCHEME.
-
- To load Pseudoscheme into a Common Lisp system, first load the file
- "loadit.lisp", then do
-
- (schi:loadit "<dir>")
-
- where <dir> is the directory in which Pseudoscheme is located. Under
- Unix, <dir> should include a final /, e.g. "/u/gjs/pseudo/". The
- first time the system is loaded, it will compile itself.
-
- Once the system is loaded, enter Scheme with
-
- (schi:scheme)
-
- and leave Scheme with
-
- (quit)
-
- There are definitions for everything that's in the Revised^4 Report on
- the Algorithmic Language Scheme, although some definitions are
- incomplete or approximate. See under "limitations," below.
-
- If you are using a Symbolics system, the first line of every Scheme source
- file should be the following:
-
- ;-*- Mode: Scheme; Syntax: Scheme; Package: Scheme; -*-
-
-
- EXTENSIONS.
-
- The following nonstandard procedures are defined:
-
- quit - leaves Scheme.
- compile-file - compiles a file of Scheme code. Arguments are as
- in Common Lisp's compile-file function.
- compile - compiles one procedure, like Common Lisp's
- compile function.
- translate-file - translates a file of Scheme code into Common Lisp.
- Output is written to a file with type ".pso"
- ("Pseudoscheme output").
- pp - prints something with
- (let ((lisp:*print-pretty* t)) ...).
- error - signals an error. Compatible with T, MIT Scheme,
- and Common Lisp.
- benchmark-mode - cause Revised^4 Scheme primitives to be
- inlined. Analogous to (declare (usual-integrations))
- in MIT Scheme.
-
- If you need an EVAL procedure, try this:
-
- (define eval #'schi:scheme-eval)
- (define scheme-user-environment schi:scheme-user-environment)
- (eval '((lambda (x) (+ x 2)) 1)
- scheme-user-environment) => 3
-
- The implementation supports macros (define-syntax), but I haven't
- written any practical documentation yet. The principles are outlined
- in the paper "Macros That Work", by Clinger and Rees, in the
- proceedings of the 1991 Symposium on Principles of Programming
- Languages. Example:
-
- (define-syntax cons-stream
- (lambda (exp rename compare)
- '(,(rename 'cons) ,(cadr exp) (,(rename 'delay) ,(caddr exp)))))
-
- which is roughly equivalent to
-
- (define-syntax cons-stream
- (syntax-rules ()
- ((cons-stream head tail)
- (cons head (delay tail)))))
-
- There are other useful features internally, notably a record package
- and a rudimentary module system. These are currently undocumented.
-
-
- LIMITATIONS.
-
- Tail recursion will work for ordinary loops written using LETREC,
- internal DEFINE, and named LET; in other cases, however, you will have
- true tail recursion only if the underlying Common Lisp supports it.
-
- CALL-WITH-CURRENT-CONTINUATION is implemented using Common Lisp BLOCK
- and is therefore not as general as in a true Scheme.
-
- Arithmetic is Common Lisp's, not Scheme's, so the exact/inexact
- distinction isn't implemented quite right.
-
- Identifiers beginning with & may produce warnings or not work when
- running under some Common Lisp implementations. E.g. Lucid will say
- "Error: (&FOO) is an ill-formed lambda-list" for (lambda (&foo) &foo).
-
- The Common Lisp reader rejects the identifier "...".
-
- Certain Common Lisp implementations implement some instances of the
- Lisp FUNCTION type as conses; in this case, the PAIR? procedure may
- return #T for some procedures.
-
- The WRITE procedure will generate incorrect output for structures
- containing #T, #F, and ().
-
-
- INTERACTION BETWEEN SCHEME AND COMMON LISP.
-
- You can generally call Common Lisp functions from Scheme programs by
- using package prefixes, e.g.
-
- (define (openit)
- (lisp:open "foo.txt" :direction :output))
-
- Most data types correspond closely: Scheme pairs are Lisp conses,
- procedures are functions, ports are streams, etc. The main difference
- is that Scheme boolean false (#F) is different from Lisp boolean false
- (NIL). You should therefore beware of any use of booleans in calls
- out to Common Lisp. The functions SCHI:TRUE? and SCHI:TRUEP can be
- used to handle coercions between the two: SCHI:TRUE? turns LISP:NIL
- into #F, and SCHI:TRUEP turns #F into LISP:NIL.
-
- Common Lisp special forms and macros may or may not work in Scheme
- code, because of the variable renaming that Pseudoscheme performs and
- its implicit insertion of FUNCALL's and SPECIAL declarations. Usually
- a special form works if it has the syntax of a function call (as do
- e.g. LISP:UNWIND-PROTECT or LISP:CATCH). If you need to know, you
- can see what the translator does by doing (LISP:MACROEXPAND
- '<scheme-expression>).
-
- You can do Common Lisp special binding from Scheme code using LET or
- LAMBDA if the variable is not in the SCHEME package and the variable is
- proclaimed special, e.g.
-
- (let ((lisp:*print-level* 10)) ...)
-
- While Scheme is running, *PACKAGE* is ordinarily bound to the SCHEME
- package.
-
-
- REBUILDING THE TRANSLATOR.
-
- To rebuild the translator (.pso files) from sources (the .scm files),
- follow the directions at the top of file bootit.scm.
-
-
- NEW IN VERSION 2.8.
-
- - #F and () are distinct values. Among other things, this means that
- (null? #f) and (not '()) are now #f instead of #t.
-
- - The dialect supported is Revised^3.99 Scheme, not Revised^3 Scheme.
- This means that a few things have gone away (T, NIL, LAST-PAIR), a
- few things have changed (arguments to NUMBER->STRING and
- STRING->NUMBER), and there are a few new features (PEEK-CHAR,
- LIST?).
-
- - As required by the Scheme report, the built-in Scheme procedures are
- not integrated by default. This means that you can SET! or DEFINE
- any name (except for the syntactic keywords). It also means,
- however, that programs will run more slowly than would have under
- version 2.7. To obtain better performance, evaluate
- (benchmark-mode).
-
- - define-syntax and syntax-rules, as not described above.
-